﻿@model Tasks.UI.Models.Account.EnterpriseManageModel
@{
    Layout = "~/Views/Account/_AccountMaster.cshtml";
    
    
}
@section head{
    <script type="text/javascript">

        $(function () {
            initProvince("#ProvinceID");
            initCity("#CityID");

            initTable(".tblStyle1");
        })

        //删除
        function deleteEnterpriseMember(UserID) {
            $("#UserID").val(UserID);

            goto("delete");
        }
        //禁用
        function disableEnterpriseMember(UserID) {
            $("#UserID").val(UserID);

            goto("disable");
        }
        //启用
        function enableEnterpriseMember(UserID) {
            $("#UserID").val(UserID);
            $("#act").val("enable");

            goto("enable");
        }

        function goto(act) {
            if (act == "search")
                $("#PageIndex").val("1");

            $("#act").val(act);
            $("form").submit();
        }
    </script>
}
@using (Html.BeginForm())
{
    <input id="UserID" name="UserID" type="hidden" />
    <input id="act" name="act" type="hidden" />
 
    
    
    <div class="navTitle">
        <ul>
            <li class="Home SecondLast"><a href="#">
                <div class="HomeIcon">
                </div>
                <font><font>Home</font></font></a></li><li class="Last"><span><font><font>企业会员管理</font></font></span></li>
        </ul>
    </div>
    <h1>
        <font><font class="">查看所有企业</font></font>
    </h1>
    <p class="intro">
        <font><font>企业资料如下。</font><font
            class="">点击“添加企业”按钮来添加一个新的企业。添加完企业后请为企业分配权限。 </font></font>
    </p>
    <div class="searchBar">
        <div class="box">
            <table>
                <tr>
                    <td style="width: 80px;">
                        <label>
                            名 称：</label>
                    </td>
                    <td style="width: 180px;">
                        @Html.TextBoxFor(t => t.Name)
                    </td>
                    <td style="width: 80px;">
                        <label>
                            公司分组：</label>
                    </td>
                    <td>
                        @Html.DropDownListFor(d => d.CategoryID, PageHelper.EnterpriseMemberCategorySelector(Model.CategoryID))
                        <span class="unadv">
                            <input id="btnSearch" type="button" value="查询" class="btnSearch" onclick="goto('search')" />
                            </span>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>
                            地 区：</label>
                    </td>
                    <td colspan="3">
                        @Html.DropDownList("ProvinceID", PageHelper.ProvinceSelector(Model.ProvinceID))
                        @Html.DropDownList("CityID", PageHelper.CitySelector(Model.CityID, Model.ProvinceID))
                        @Html.DropDownList("AreaID", PageHelper.AreaSelector(Model.AreaID, Model.CityID))
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>
                            企业类型：</label>
                    </td>
                    <td colspan="3">
                        @Html.DropDownListExt("EnterpriseType", PageHelper.EnterpriseTypeSelector(Model.EnterpriseType))
                    </td>
                </tr>
            </table>
            <div class="bottom">
            </div>
        </div>
    </div>
     <div class="cpsoso">
                <div class="cpsosofenye">
                   </div>
                <div class="cpsosoleft">
                    <a href="javascript:void(0)" onclick="openTab('新增企业会员','/Account/EditEnterpriseMember?EnterpriseType=@Model.EnterpriseType',true)"><span>
                        新增企业会员</span></a> 或
                    <select name="select" id="select">
                        <option>- 选择动作 - </option>
                        <option>删除选定</option>
                    </select>
                    <a href="javascript:void(0)"><span>去</span></a></div>
            </div>
    
    
    <div class="pageBody">
        <table class="tblStyle1" style="table-layout: fixed;">
            <thead>
                <tr>
                    <th style="width: 8%;">
                        状态
                    </th>
                    <th style="width: 8%;">
                        企业类型
                    </th>
                    <th style="width: 20%;">
                        名称
                    </th>
                    <th style="width: 10%;">
                        联系人
                    </th>
                    <th style="width: 10%;">
                        座机
                    </th>
                    <th style="width: 10%;">
                        手机
                    </th>
                    <th style="width: 10%;">
                        传真
                    </th>
                    <th style="width: 8%;">
                        允许登录
                    </th>
                    <th style="width: 15%;">
                        操作
                    </th>
                </tr>
            </thead>
            <tbody>
                @foreach (EnterpriseMember EpMember in Model.EnterpriseMemberlist)
                {
                    if (EpMember.Contact == null)
                    {
                        EpMember.Contact = new ContactInfo();
                    }
                    <tr align="center">
                        <td>
                            @if (EpMember.EnterpriseMemberState == 1)
                            {
                                @Html.Label("有效");
                            }
                            else
                            {
                                @Html.Label("无效");
                            }
                        </td>
                        <td>
                            @EpMember.ToEnterpriseTypeStr()
                        </td>
                        <td>
                            @EpMember.Name
                        </td>
                        <td>
                            @EpMember.Contact.Linkman
                        </td>
                        <td>
                            @EpMember.Contact.LinkmanTel
                        </td>
                        <td>
                            @EpMember.Contact.LinkmanMobileNo
                        </td>
                        <td>
                            @EpMember.Contact.LinkmanFax
                        </td>
                        <td>
                            @(EpMember.IsDistribution == 1 ? "是" : "")
                        </td>
                        <td>
                            <a href="javascript:void(0)" onclick="openTab('编辑企业会员','/Account/EditEnterpriseMember?UserID=@EpMember.UserID',true)">
                                <img src="/images/icon/16x16/file_edit.png" title="编辑" /></a> <a href="javascript:void(0)" onclick="openTab('授权','/Power/AssignUserPower?UserID=@EpMember.UserID',false)">
                                    <img src="/images/icon/16x16/key.png" title="授权" /></a> <a href="javascript:void(0)" onclick="openTab('权限组','/Power/AssignRole?UserID=@EpMember.UserID',true)">
                                        <img src="/images/icon/16x16/group_key.png" title="权限组" /></a>
                            @if (EpMember.EnterpriseMemberState == 1)
                            {
                                <a href="javascript:void(0)" onclick="deleteEnterpriseMember(@EpMember.UserID)" >
                                    <img src="/images/icon/16x16/delete.png" title="删除" /></a>
                                <a href="javascript:void(0)" onclick="disableEnterpriseMember(@EpMember.UserID)">
                                    <img src="/images/icon/16x16/stop.png" title="禁用" /></a>
                            }
                            else if (EpMember.EnterpriseMemberState == 2)
                            {
                                <a href="javascript:void(0)" onclick="enableEnterpriseMember(@EpMember.UserID)"  >
                                    <img src="/images/icon/16x16/enable.png" title="启用" /></a>
                            }
                            else
                            {
                                <a href="javascript:void(0)" onclick="enableEnterpriseMember(@EpMember.UserID)"  title="启用">
                                    <img src="/images/icon/16x16/enable.png" /></a>
                            }
                        </td>
                    </tr>
                }
            </tbody>
        </table>
        @Html.RenderPageNav(Model.PageIndex, Model.PageSize, Model.RowCount, "", Tasks.Core.PageNavStyle.Form)
    </div>
}
